package utils;

import exceptions.ConfigException;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author Timur Yarosh
 *         Date: 28.05.13
 *         Time: 10:30
 */
public class ConfigurationLoader {
    /**
     * Load configuration file
     *
     * @param configInputStream InputStream with configuration file
     * @return map with config
     * @throws exceptions.ConfigException
     *          if an error occurred while reading the config
     */
    public static Properties loadConfig(InputStream configInputStream) throws ConfigException {
        Properties props = new Properties();
        try {
            props.load(configInputStream);
        } catch (IOException e) {
            throw new ConfigException(e.getMessage());
        }
        return props;
    }
}
